﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TranslationViewModel.cs" company="WordSteps.com">
//   All rights reserved
// </copyright>
// <summary>
//   Defines the TranslationViewModel type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace RapidDict.Modules.Translator.Views
{
    using RapidDict.Infrastructure.Interfaces;
    using RapidDict.Infrastructure.Models;

    public class TranslationViewModel : ViewModelBase
    {
        private readonly ITranslationService translationService;

        public TranslationViewModel(ITranslationService translationService)
        {
            this.translationService = translationService;
            this.translationService.WordChanged += (s, e) =>
                                                       {
                                                           NotifyPropertyChanged("Word");
                                                           NotifyPropertyChanged("Translation");
                                                       };

            // default phrase
            this.Word = "Enter a word or a phrase for translation";
        }

        public string Translation
        {
            get
            {
                return this.translationService.GetTranslation();
            }
        }

        public string Word
        {
            get
            {
                return this.translationService.GetWord();
            }

            set
            {
                this.translationService.SetWord(value);
            }
        }
    }
}